steps include:
Requires HOBO water level logger and conductivity probe raw data and manual measurement spreadsheet
Check that data matches column names
interfiles <- 'formatted_data/stage_pressure'
year <- '2022'
location<- 'ssfp'
pstage_raw <- opn_concat_psite(interfiles, year, location)
pstage_raw$datetime <- round_date(pstage_raw$datetime, "10 mins")
The density of water is temperature dependent, however, our water temperatures have a small range when the sensor is submerged…
## mintemp maxtemp
## 1 0.784 22.429
Generate a dataframe with an added column for ‘depth’ based on an equation using the difference between the atmospheric pressure and the well pressure on for the same date and time.
pstage_depth <- inner_join(filter(pstage_raw, position =="atmospheric"), filter(pstage_raw,position != "atmospheric"), by= c("datetime")) %>%
mutate(depth_m = (pressure_kPa.y-pressure_kPa.x)/(0.999*9.98)) %>%
select(ID.y, datetime, pressure_kPa.x, pressure_kPa.y, depth_m, position.y, instrument_no.y, temperature_C.y, site.y)
Plot does not reflect data prior to 1pm on May 24th (approximate sensor installation time)
interfiles <- 'formatted_data/conductivity'
# possible locations: 'dh', 'est_louis', 'fool', 'lexen'
year <- '2022'
location <- 'ssfp'
cond_raw <- opn_conduct_ssfp(interfiles, year, location)
cond_raw$datetime <- round_date(cond_raw$datetime, "10 mins")
and plot for the same time period as well stage data
cond_plot <- cond_raw[cond_raw$position != 'flumeshallow',]
cond_plot <- cond_plot[cond_plot$datetime > ymd_hms('2022-05-24 13:00:00', tz = 'MST'),] %>%
tidyr::unite(.,"site_posit",site,position,remove = F)
ssfp_cond <- ggplot(cond_plot, aes(datetime, full_range_us_cm, color= site_posit))+
geom_line() +
scale_colour_manual(values = c( "brown1", "brown2", "brown3", "chartreuse3","forestgreen","darkgreen", "gray37", "gray27"))
ggplotly(ssfp_cond)
cond_merg <- cond_plot[c("datetime", "position", "site", "full_range_us_cm")]
m1 <- merge(cond_merg, depth_plot, by = c('datetime','site', 'position'))
mcut <- m1[m1$site == 'cut', ]
scaleFactor <- max(m1$full_range_us_cm, na.rm = T) / max(m1$depth_m, na.rm = T)
cwrapped <- ggplot(mcut, aes(x=datetime)) +
geom_line(aes(y=full_range_us_cm), method="loess", col="red") +
geom_point(aes(y=depth_m * scaleFactor), method="loess", col="blue") +
geom_hline(yintercept=10) +
scale_y_continuous(name="Conductivity (us/cm)", sec.axis=sec_axis(~./scaleFactor, name="Depth (m)")) +
theme(
axis.title.y.left=element_text(color="red"),
axis.text.y.left=element_text(color="red"),
axis.title.y.right=element_text(color="blue"),
axis.text.y.right=element_text(color="blue")) +
facet_wrap(~position) +
ggtitle('Regenerating/cut plot - low wells depth and conductivity')
cwrapped
muncut <- m1[m1$site == 'uncut', ]
scaleFactor <- max(m1$full_range_us_cm, na.rm = T) / max(m1$depth_m, na.rm = T)
uwrapped <- ggplot(muncut, aes(x=datetime)) +
geom_line(aes(y=full_range_us_cm), method="loess",col="green") +
geom_point(aes(y=depth_m * scaleFactor), method="loess", col="blue") +
geom_hline(yintercept=10) +
scale_y_continuous(name="Conductivity (us/cm)", sec.axis=sec_axis(~./scaleFactor, name="Depth (m)")) +
theme(
axis.title.y.left=element_text(color="green"),
axis.text.y.left=element_text(color="green"),
axis.title.y.right=element_text(color="blue"),
axis.text.y.right=element_text(color="blue")
) +
facet_wrap(~position) +
ggtitle('Old growth/uncut plot - low wells depth and conductivity')
uwrapped
#checkTimesteps(pstage_raw)
###compare cleaned water level to manual measurements
#plot difference between measured water depth and manual depth measurement
#stageAdj.man<- left_join(manMeas_fil,stage_adj)%>%
# mutate(diff = man_wtr_dep_static-wtr_depth)
#ggplot(stageAdj.man, aes(datetime, diff))+
# geom_point(size=3)+
# theme_minimal()
#plot water level time series with manual measurements as points
#stage_check_plot<- stage_adj%>%
# left_join(manMeas_fil)%>%
# ggplot(aes(datetime,wtr_depth))+
# geom_line()+
# geom_point(aes(datetime, man_wtr_dep_static),size=3,col='red')
#ggplotly(stage_check_plot)
###save
#stage_final <- stage_adj%>%
# dplyr::select(location, site, datetime, wtr_depth,level_flag)
#loc_site<- paste(location,site, sep='_')
#interfiles <- './data/3_cleaned_stage_caprod'
#file_path <- paste(interfiles,location,site, sep='/')
#saveRDS(stage_final, file=paste0('data/cln/wtr_lvl_',loc_site,'.csv'))
#write_csv(stage_final, file=paste0(file_path, '_clean.csv'))